/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bunga;

import java.util.*;
import java.text.*;

public class KaranganBunga {

    // Daftar <link, teks>
    private static Hashtable GROUP = new Hashtable();
    // Daftar item Bunga
    private static Hashtable T_Karanganbunga1 = new Hashtable();
    private static Hashtable T_Karanganbunga2 = new Hashtable();
    private static Hashtable T_Karanganbunga3 = new Hashtable();
    private static Hashtable T_Karanganbunga4 = new Hashtable();
    private static Hashtable T_Karanganbunga5 = new Hashtable();
    private static Hashtable T_Karanganbunga6 = new Hashtable();
    private static Hashtable T_Karanganbunga7 = new Hashtable();
    private static Hashtable T_Karanganbunga8 = new Hashtable();

    /** Creates a new instance of DataBunga */
    public KaranganBunga() {
        GROUP.put("001", "Karangan bunga1");
        GROUP.put("002", "Karangan bunga2");
        GROUP.put("003", "Karangan bunga3");
        GROUP.put("004", "Karangan bunga4");
        GROUP.put("005", "Karangan bunga5");
        GROUP.put("006", "Karangan bunga6");
        GROUP.put("007", "Karangan bunga7");
        GROUP.put("008", "Karangan bunga8");

        T_Karanganbunga1.put("Karangan bunga1", new Double(650000));
        T_Karanganbunga2.put("Karangan bunga2", new Double(700000));
        T_Karanganbunga3.put("Karangan bunga3", new Double(400000));
        T_Karanganbunga4.put("Karangan bunga4", new Double(450000));
        T_Karanganbunga5.put("Karangan bunga5", new Double(500000));
        T_Karanganbunga6.put("Karangan bunga6", new Double(650000));
        T_Karanganbunga7.put("Karangan bunga7", new Double(900000));
        T_Karanganbunga8.put("Karangan bunga8", new Double(900000));




    }

    // Group
    public static Enumeration getGroupKeys() {
        return GROUP.keys();
    }

    public String getTeks(String key) {
        return (String) GROUP.get(key);
    }

    // Item Bunga
    private static Hashtable getTable(String cd) {
        Hashtable ht = null;
        if (cd.equalsIgnoreCase("001")) {
            ht = T_Karanganbunga1;
        } else if (cd.equalsIgnoreCase("002")) {
            ht = T_Karanganbunga2;
        } else if (cd.equalsIgnoreCase("003")) {
            ht = T_Karanganbunga3;
        } else if (cd.equalsIgnoreCase("004")) {
            ht = T_Karanganbunga4;
        } else if (cd.equalsIgnoreCase("005")) {
            ht = T_Karanganbunga5;
        } else if (cd.equalsIgnoreCase("006")) {
            ht = T_Karanganbunga6;
        } else if (cd.equalsIgnoreCase("007")) {
            ht = T_Karanganbunga7;
        } else if (cd.equalsIgnoreCase("008")) {
            ht = T_Karanganbunga8;
        }
        return ht;
    }

    public static Enumeration getItemKeys(String cd) {
        return (getTable(cd).keys());
    }

    public static double getNPrice(String cd, String key) {
        double price = ((Double) getTable(cd).get(key)).doubleValue();
        return price;
    }
}
